﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master"
    CodeBehind="HotelList.aspx.vb" Inherits="Travel.HotelList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <asp:PlaceHolder ID="ph_SuperUsers" runat="server">
        This is only for superusers!
    </asp:PlaceHolder>
    <p>
        <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource2">
            <ItemTemplate>
                <a href="HotelList.aspx?Tag=<%# Eval("Tag") %>"><%# Eval("Tag") %>  </a>
            </ItemTemplate>
        </asp:Repeater>
        <br />
    </p>
    <p>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:TravelConnectionString %>"
            ProviderName="<%$ ConnectionStrings:TravelConnectionString.ProviderName %>" SelectCommand="SELECT [Tag] FROM [Tags]">
        </asp:SqlDataSource>
    </p>
    <p>
        &nbsp;</p>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ID"
        DataSourceID="SqlDataSource1" Height="136px" Width="798px">
        <Columns>
            <asp:HyperLinkField DataNavigateUrlFields="HotelUrl" DataNavigateUrlFormatString="{0}"
                DataTextField="HotelName" HeaderText="Hotels" />
            <asp:HyperLinkField DataNavigateUrlFields="Location" DataNavigateUrlFormatString="https://maps.google.co.uk/maps?q={0}"
                DataTextField="Location" HeaderText="Location" />
            <asp:TemplateField HeaderText="Stars">
                <ItemTemplate>
                    <%# getStars(Eval("Stars")) %></ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
            <asp:TemplateField HeaderText="Picture">
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("ID", "HotelDetail.aspx?ID={0}") %>'>
                        <img src='<%# Eval("Pictures") %>'  alt="Read online"  width="200" height="150" style="border-style: solid; border-width: medium" />
                    </asp:HyperLink>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:HyperLinkField DataNavigateUrlFields="ID" DataNavigateUrlFormatString="HotelDetail.aspx?ID={0}"
                HeaderText="Details" Text="See More" />
        </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TravelConnectionString %>"
        ProviderName="<%$ ConnectionStrings:TravelConnectionString.ProviderName %>" SelectCommand="SELECT [ID], [HotelName], [Stars], [Location], [Description], [HotelUrl], [Pictures] FROM [Hotels]">
    </asp:SqlDataSource>
    <p>
    </p>
    <p>
    </p>
    <p>
        <asp:GridView ID="GridView3" runat="server" AutoGenerateColumns="False" 
            DataSourceID="SqlDataSource3">
            <Columns>
                <asp:BoundField DataField="HotelName" HeaderText="HotelName" 
                    SortExpression="HotelName" />
                <asp:BoundField DataField="Stars" HeaderText="Stars" SortExpression="Stars" />
                <asp:BoundField DataField="Description" HeaderText="Description" 
                    SortExpression="Description" />
                <asp:BoundField DataField="Pictures" HeaderText="Pictures" 
                    SortExpression="Pictures" />
                <asp:BoundField DataField="HotelUrl" HeaderText="HotelUrl" 
                    SortExpression="HotelUrl" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
            ConnectionString="<%$ ConnectionStrings:TravelConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:TravelConnectionString.ProviderName %>" 
            CancelSelectOnNullParameter="False">
            
            <SelectParameters>
                <asp:QueryStringParameter Name="Tag" QueryStringField="Tag" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
    </p>
    <p>
    </p>
    <p>
    </p>
</asp:Content>
